package car.aistar.service.impl;

import car.aistar.dao.SellReserveDao;
import car.aistar.entity.Admin;
import car.aistar.entity.SellReserve;
import car.aistar.service.SellReserveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (SellReserve)表服务实现类
 *
 * @author makejava
 * @since 2020-09-30 20:26:30
 */
@Service("sellReserveService")
public class SellReserveServiceImpl implements SellReserveService {
    @Autowired
    private SellReserveDao sellReserveDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SellReserve queryById(Long id) {
        return this.sellReserveDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<SellReserve> queryAllByLimit(int offset, int limit) {
        return this.sellReserveDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param sellReserve 实例对象
     * @return 实例对象
     */
    @Override
    public SellReserve insert(SellReserve sellReserve) {
        this.sellReserveDao.insert(sellReserve);
        return sellReserve;
    }

    /**
     * 修改数据
     *
     * @param sellReserve 实例对象
     * @return 实例对象
     */
    @Override
    public SellReserve update(SellReserve sellReserve) {
        this.sellReserveDao.update(sellReserve);
        return this.queryById(sellReserve.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.sellReserveDao.deleteById(id) > 0;
    }

    @Override
    public List<SellReserve> queryAll(SellReserve sellReserve) {
        return this.sellReserveDao.queryAll(sellReserve);
    }
}